Skip to content

refactor: clean up renderer.py internals - #424

Merged
oarriaga merged 4 commits into
paz-jaxfrom
refactor/renderer-style
Aug 9, 2026
Merged

refactor: clean up renderer.py internals#424
oarriaga merged 4 commits into
paz-jaxfrom
refactor/renderer-style

Conversation

@oarriaga

@oarriaga oarriaga commented Aug 2, 2026

Copy link
Copy Markdown
Owner

renderer.py had drifted from our style rules: two Args namedtuples, several
def f(*args) signatures unpacked positionally, nested defs, early returns, a
typo. Cleaned those up, and dropped dead code found on the way — rays was
threaded through four call levels unread, compute_new_rays took a
reflectance it never used, the closest-hit argmin ran twice per bounce.
Added a Surfaces namedtuple so points/normals/eyes stop travelling as a
positional triple. 661 to 606 lines, no behaviour change.

pytest paz/graphics/: 252 passed, 1 skipped (GPU only) — the image/depth/
gradient snapshots are the guard. Also smoke-checked the jitted render path,
render_masks, and the compute_soft_occlusion patch the shape-rendering
examples use.

Not doing here: splitting the shadows= flag into separate functions (breaks
the public API and every example), and swapping in geometry.refract (its TIR
branch differs, would change pixels). Related, for later: we compute
reflectance >= 1.0 for TIR and apply it to throughput but not to the bounce
direction.

oarriaga added 4 commits July 29, 2026 16:11
Drop the two Args namedtuples and the `def f(*args)` signatures that
unpacked positionally, in favour of explicit parameters. Single returns,
nested defs lifted out, `transparancies` typo fixed, over-length lines
wrapped.

Also removes dead code found on the way: `rays` was threaded through
four call levels unread, `compute_new_rays` took a `reflectance` it
never used, the closest-hit argmin ran twice per bounce, and
`same_shape` was computed twice per light. Adds a `Surfaces` namedtuple
so points/normals/eyes stop travelling as a positional triple.

No behaviour change. pytest paz/graphics/: 252 passed, 1 skipped.
@oarriaga
oarriaga force-pushed the refactor/renderer-style branch from 9dea724 to 481f4f3 Compare August 2, 2026 17:30
@oarriaga oarriaga changed the title refactor: bring renderer.py in line with the agent guide refactor: clean up renderer.py internals Aug 2, 2026
@oarriaga
oarriaga merged commit 93f1518 into paz-jax Aug 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant